package {
	import com.google.analytics.debug._Style;
	import com.greensock.TweenMax;
	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	
	import org.osflash.signals.Signal;

	public class FindCircle extends Circle {
		
		private var _bitmap:Bitmap;
		private var _stencil:MovieClip;
		public var start:Signal;
		private var _cornered:Boolean;
		
		public function FindCircle(view:MovieClip) {
			super(view);
			start = new Signal();
			_view.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
		}
		
		public function displayStencil(stencil:MovieClip):void {
			if(_stencil) _view.removeChild(_stencil);
			_stencil = stencil;
			_view.addChild(stencil);
			stencil.visible = true;
			stencil.y = 0;
			stencil.x = 0;
			stencil.scaleX = stencil.scaleY = .9;
		}
		
		
		
		protected override function onRollOver(e:MouseEvent):void {
			TweenMax.to(_stencil, .4 , {glowFilter:{color:0xFFFFFF, alpha:1, blurX:80, blurY:80, quality:3}});
		}
		
		protected override function onRollOut(e:MouseEvent):void {
			TweenMax.to(_stencil, .4 , {glowFilter:{color:0xFFFFFF, alpha:0, blurX:10, blurY:10}});
		}
		
		private function onMouseDown(e:MouseEvent):void {
			
			start.dispatch();
		}
		
		public function corner():void {
			_cornered = true;
			TweenMax.to(_view, .3, {x:1024 - _view.width * .5 + 60, y: _view.height * .5 - 60, scaleX:.4, scaleY:.4});	
		}
		
		public function center():void {
			_cornered = false;
			TweenMax.to(_view, .3, {x:1024 * .5, y:300, scaleX:1, scaleY:1});
		}
		
		public function get cornered():Boolean {
			return _cornered;
		}
		
	}
}